Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Key Press Event Help

  1. #1

    Default Key Press Event Help

    Hey All,

    So, if I wanted to make the rabbit (a certain player) jump higher than other players, could I use the keypress event to check and see if a player has pressed their jump key? If so, how would I do it? The event system documentation is a bit vague with this event.

    Trying to accomplish the following:

    Code:
    local.result = registerev "keypress" global/example.scr::keypress
    
    keypress local.player local.keynum:
       if(local.keynum == [PLAYER_JUMP_KEY]){
           if(local.player == level.rabbit){
                   level.rabbit jump int(getcvar("r_jumpHeight"))
           }
       }
    end
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  2. #2
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    Technically it's possible. However you will have to edit the player's jump bind to add "+moveup; keyp X". Even if your script detects the keypress,
    the player will make a normal jump regardless. So you may want to assign a different bind for the keypress event. Alternatively, you could detect
    a jump from your designated 'rabbit' (checking .velocity[2]) and increase the Z velocity to make him jump higher.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  3. #3
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    How does Admin pro's command make a certain person jump a height ?

    Couldnt that be used with the keybind or triggers when the 'rabbit' jumps and used that way , just curious now but im sure Sor's way is better

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  4. #4
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    I think it uses the state files. But doing so would execute the jump script each time a client jumps in your server.

    @own3mall, just for reference, I forgot to mention that the standard jump height is 56 units.
    Last edited by Sor; November 14th, 2012 at 07:43 AM.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  5. #5
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    Oh ok ,

    I know it can make a certain player jump without any input from them , just come the command admin_cmd 1 jump 100 or something like that , could you just detect when when the 'rabbit' jumps then exec it on it , but if it uses state files then its probs too over complicated for just making a player jump higher

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  6. #6
    Developer Sor's Avatar
    Join Date
    Aug 2010
    Location
    The Medieval City of Bruges
    Posts
    747

    Default

    If your using such a console cvar, the function, I reckon, would first find the player with the corresponding #id and then apply the 'jump' or even 'jumpxy' command on him/her with int("100"). The problem with this is while it does not require the client in question to do anything, it requires the admin to enter that cvar into the server console.

    The advantage of (checking) velocity (if I recall this correctly, it's been a while) is that it not only shows the speed of the entity but also the directions that speed is exerted. If a client jumped normally, at one point its Z-velocity would reach 56.000 and then decrease back to 0.000. When detected, just gradually give the player a Z-velocity boost. Disadvantage is that you'll have to loop this though. I'm in college now, will post a code snippet when I get home.
    Morpheus Script (MoH) => You try to shoot yourself in the foot only to discover that MorpheusScript already shot your foot for you.

  7. #7

    Default

    state files are way easier.. 5 lines max.

    velocity, just as easy but just as many checks.


    there is no advantage of either imo, both impacts are the same. states maybe even less.


    you wouldnt have to loop it though either..just add velocity on to a player and mohaa will do the rest.

    remember keep it simple, things may appear sexy and nice doing all advanced maths stuff, but in the end, if it can be done simple, do it simple.


    + velocity or just use states.,
    id go velocity to avoid state edits if you are releasing this mod. and then its simple if z >0 .add z..done

  8. #8
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    So you apply the KISS principle

    KISS = Keep It Simple Stupid

    Something i always got told when i was younger :P

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  9. #9

    Default

    Quote Originally Posted by Elgan View Post
    state files are way easier.. 5 lines max.

    velocity, just as easy but just as many checks.


    there is no advantage of either imo, both impacts are the same. states maybe even less.


    you wouldnt have to loop it though either..just add velocity on to a player and mohaa will do the rest.

    remember keep it simple, things may appear sexy and nice doing all advanced maths stuff, but in the end, if it can be done simple, do it simple.


    + velocity or just use states.,
    id go velocity to avoid state edits if you are releasing this mod. and then its simple if z >0 .add z..done
    Do you have an example? I've never used the velocity function.

    Code:
    level.rabbit velocity 1000
    while(isAlive(level.rabbit)){
        
    }
    level.rabbit velocity normalVal
    Browse MOHAA Servers Post GameSpy Era

    VISIT MOHREBORN.COM FOR LATEST INFORMATION



    Medal of Honor: Game Server Browser Fixer - Patches your MOHAA, MOHSH, and MOHBT game binaries to allow you to retrieve a list of game servers within the multi-player menu in-game even after GameSpy ceases operation!

    Medal of Honor: Query Launcher - Find, browse, organize, join, get your ping, and get more information regarding all Medal of Honor (AA, SH, & BT) servers from your PC at any time!
    Medal of Honor: Web Server Master List - Find and browse all Medal of Honor servers online using your browser!
    Add your Medal of Honor Server to the Master List
    YouTube Video for Medal of Honor: Query Launcher and MOHAASERVERS.TK!



    MOHAA Mods and Utilities
    OwN-3m-All's Mods
    Make Me Stock - A program that allows you to easily move-in and move-out non-stock mods and other files at the click of a button. Automates adding / removing mods without having to copy / move files manually.



    Quality Game Servers

    Rent dedicated Dallas Texas, Kansas City, Las Vegas Nevada, Chicago, Pennsylvania, and Sofia Bulgaria MOHAA and other game servers from We Be HostiN starting at $10 a month.


  10. #10
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    I think velocity is in same format as coords

    So it would be

    level.rabbit.velocity = ( X Y Z )

    Z being up and down

    Quote Originally Posted by Sor View Post
    Alternatively, you could detect
    a jump from your designated 'rabbit' (checking .velocity[2]) and increase the Z velocity to make him jump higher.
    @Sor Could you use something similar to Elgans Jetpack mod in admin pro to increase Z velocity using vectors : self.velocity += self.upvector * 15 : or is it just as easy to add a higher value to Z
    or would that cause something of a 'double jump' not so smooth in transition. Although from a rabbits point of view it would be more visual noticeable if it was a kind of 'double jump'
    Last edited by Purple Elephant1au; November 14th, 2012 at 09:38 PM.

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •